<!DOCTYPE html>
<html lang="zh" dir="ltr">
<head>
  <meta charset="utf-8">
  <title>文件预览中...</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
</head>
<body>
</body>
<script>
    (async function (){
      const checkFile =function(name){
        var nsz = name.split(".");
        var ext = nsz[nsz.length - 1];
        var ali = "3dm,3ds,asm,cam360,catpart,catproduct,cgr,collaboration,dae,dgn,dlv3,dwf,dwfx,dwg,dwt,dxf,exp,f3d,fbx,g,gbxml,iam,idw,ifc,ige,iges,igs,ipt,jt,model,neu,nwc,nwd,obj,prt,rvt,sab,sat,session,skp,sldasm,sldprt,smb,smt,ste,step,stl,stla,stlb,stp,wire,x_b,x_t,xas,xpr".split(",");
        if(ali.includes(ext.toLowerCase())){
          return "index.html";
        }
        return;
      }
      var path = decodeURIComponent( '<?php echo @$_GET["path"];?>');
      var name = decodeURIComponent('<?php echo @$_GET["name"];?>');
      let page = checkFile(name);
      if(!page || page != "index.html"){
        Tips.tips("当前文件不支持","error");
        return;
      }
      let file_id = "";
      const res = await fetch("<?php echo $this->pluginHost;?>static/api.php?type=1&path="+encodeURIComponent(path)).then(function (res){return res.json();});
      if(res.flag){
            file_id = res.data;
      }
      page = "<?php echo $this->pluginHost;?>"+"static/autoCad/"+page+"?path="+encodeURIComponent(path)+"&file_id="+encodeURIComponent(file_id)+"&name="+encodeURIComponent(name);
      window.location.href = page;
    })()
</script>
</html>
